package com.jlpay.openapi.demo.trans.common;

import com.jlpay.open.jlpay.sdk.java.model.trans.common.request.PreAuthQueryRequest;
import com.jlpay.open.jlpay.sdk.java.model.trans.common.response.PreAuthQueryResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author dengwenning
 * @since 2024/9/23
 **/
public class PreAuthQueryService {
    private static final Logger LOGGER = LoggerFactory.getLogger(PreAuthQueryService.class);

    public static void main(String[] args) {
        PreAuthQueryRequest preAuthQueryRequest = buildPreAuthQueryRequest();
        PreAuthQueryResponse preAuthQueryResponse = JlpayOpenApiService.openMerchService()
                .post(preAuthQueryRequest, PreAuthQueryResponse.class);
        LOGGER.info("预授权查询响应:{}", JsonUtils.toString(preAuthQueryResponse));
    }

    private static PreAuthQueryRequest buildPreAuthQueryRequest() {
        PreAuthQueryRequest preAuthQueryRequest = new PreAuthQueryRequest();

        preAuthQueryRequest.setMchId("849584358120018");
        preAuthQueryRequest.setOutTradeNo("ld201911023465529");
        preAuthQueryRequest.setTransactionId("80011557201909171853011568");

        return preAuthQueryRequest;
    }
}
